/**
* Created by yt758 on 2025/2/22.
* */
#include "AppDelegate.h"
#include "GlobalParameters.h"
#include <string>
#include "Simu/Simu.h"
#include "RspTask/RspTask.h"
#include "MyDeviceReader/MyDeviceReader.h"
#include "Spot/Spot.h"
#include "MyDeviceWriter/MyDeviceWriter.h"

void AppDelegate::onConfigure(device_config_t *config){
    config->calculationPoolSize=8;
    config->globalParametersInstance = GlobalParameters::shareInstance();
    config->deviceId=1;
    config->servicePort=55261;
    config->ip="192.168.1.11";
    config->userVersion="1.0";
}

void AppDelegate::onStart(){
    REGISTER_RUNTIME_LOADED_CLASSES(Simu,MyDeviceReader,RspTask,Spot,MyDeviceWriter);
    auto simu = new Simu();
    auto rspTask = new RspTask();
    auto spot = new Spot();

    auto radarlabReader = new MyDeviceReader();
    radarlabReader->addTaskModule(simu,0,1024);

    simu->addOutput(0,0,rspTask,1024);
    rspTask->addOutput(0,0,spot,1024);

    auto radarlabWriter = new MyDeviceWriter();
    spot->addDeviceWriter(0,radarlabWriter,1024);
    REGISTER_INSTANCES(simu,radarlabReader,rspTask,spot,radarlabWriter);
}
